package com.csl.testjetpack.vm

import android.app.Application
import android.util.Log
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import com.csl.testjetpack.data.bean.RemoteInfo
import com.csl.testjetpack.repository.RemoteRepository

//拥有context对象 AndroidViewModel
class RemoteListViewModel(application: Application) : AndroidViewModel(application) {
    val repository = RemoteRepository.getRemoteRepository()
    var liveData : LiveData<List<RemoteInfo>?>? = null

    suspend fun getData() {
        liveData = repository.getRemotes(getApplication())
        Log.e("csl_test", "获取到的遥控器列表: $liveData")
    }

}